package model

import (
	"gorm.io/gorm"
	"time"
)

type GrouponInviteCode struct {
	Id         uint           `gorm:"column:id;type:bigint UNSIGNED;primaryKey;not null;" json:"id"`
	InviteCode string         `gorm:"column:invite_code;type:varchar(255);comment:邀请码;not null;" json:"invite_code"`       // 邀请码
	GroupId    uint           `gorm:"column:group_id;type:int UNSIGNED;comment:拼团组id;not null;default:0;" json:"group_id"` // 拼团组id
	UserId     uint           `gorm:"column:user_id;type:int UNSIGNED;comment:用户id;not null;default:0;" json:"user_id"`    // 用户id
	ExpiredAt  time.Time      `gorm:"column:expired_at;type:datetime(3);comment:过期时间;not null;" json:"expired_at"`         // 过期时间
	CreatedAt  time.Time      `gorm:"column:created_at;type:datetime(3);not null;default:CURRENT_TIMESTAMP(3);" json:"created_at"`
	UpdatedAt  time.Time      `gorm:"column:updated_at;type:datetime(3);not null;default:CURRENT_TIMESTAMP(3);" json:"updated_at"`
	DeletedAt  gorm.DeletedAt `gorm:"column:deleted_at;type:datetime(3);default:NULL;" json:"deleted_at"`
}

func (gic *GrouponInviteCode) TableName() string {
	return "groupon_invite_code"
}
